package org.dandsoft.blackbox.snn;

import org.dandsoft.blackbox.snn.study.Teacher;

import java.util.Hashtable;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: dvilyuzhanin
 * Date: 24.03.2009 19:31:41
 */
public class Container {

    private Hashtable<ObjectId, Trigger> triggers = new Hashtable<ObjectId, Trigger>();

    public void alive(Environment environment) {
        for (Map.Entry<ObjectId, Trigger> triggerEntry : triggers.entrySet()) {
            triggerEntry.getValue().activate(environment);
        }
    }

    public void study(Environment environment, Teacher teacher) {
        for (Map.Entry<ObjectId, Trigger> triggerEntry : triggers.entrySet()) {
            teacher.study(environment, triggerEntry.getValue());
        }
    }

    public void addTrigger(Trigger trigger) {
        triggers.put(trigger.getId(), trigger);
    }

}
